﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdminDepartments.aspx.cs"
         Inherits="TaskWebApplicationUI.AdminDepartments" Theme="TaskTheme" ValidateRequest="false"
         MasterPageFile="WebTasksMaster.Master" %>
<%@ Import Namespace="TaskKernel.Configuration" %>
<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
             TagPrefix="pp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MasterPagePlaceHolder" runat="Server">
    <pp:objectcontainerdatasource id="ObjectContainerDataSource1" runat="server" 
                                  ondeleted="ObjectContainerDataSource1_Deleted" oninserted="ObjectContainerDataSource1_Inserted"
                                  onupdated="ObjectContainerDataSource1_Updated" />
    <p style="text-align: center;">
        <asp:Label ID="Department" SkinID="Department" runat="server" Text="Список отделов"></asp:Label>
    </p>
    <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataSourceID="ObjectContainerDataSource1"
                     DefaultMode="Insert" Width="293px">
        <Fields>
            <asp:TemplateField HeaderText="Название отдела">
                <InsertItemTemplate>
                    <asp:TextBox ID="DepartmentName" runat="server" CssClass="bodyt" Text='<%#Bind("DepartmentName")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Путь размещения">
                <InsertItemTemplate>
                    <asp:TextBox ID="WebPath" runat="server" CssClass="bodyt" Text='<%#Bind("WebPath")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="E-mail">
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" CssClass="bodyt" Text='<%#Bind("MailBox")%>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Рекламация">
                <InsertItemTemplate>
                    <asp:CheckBox ID="Claim" CssClass="bodyt" runat="server" Checked='<%#Bind("IsClaim")%>'></asp:CheckBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Огранич. нотификация">
                <InsertItemTemplate>
                    <asp:CheckBox ID="IsClaimNotify" CssClass="bodyt" runat="server" Checked='<%#Bind("IsClaimNotify")%>'></asp:CheckBox>
                </InsertItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="Обяз. оценка">
                <InsertItemTemplate>
                    <asp:CheckBox ID="RatingRequired" CssClass="bodyt" runat="server" Checked='<%#Bind("RatingRequired")%>'></asp:CheckBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowCancelButton="false" ShowInsertButton="True" InsertText="Внести" />
        </Fields>
    </asp:DetailsView>
    <hr />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Label ID="Label1" runat="server" ForeColor="Red" CssClass="bodyt"></asp:Label>
            <br />
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectContainerDataSource1"
                          BorderWidth="1px" CssClass="grid-view" GridLines="None" CellPadding="4" BorderStyle="None"
                          AllowSorting="True" DataKeyNames="UID">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="UID" runat="server" Text='<%#Bind("UID")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Название отдела" SortExpression="DepartmentName">
                        <ItemTemplate>
                            <a href='<%=TaskKernelConfiguration.DepUserPage%><%#Eval("UID")%>'>
                                <%#Eval("DepartmentName")%></a>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="DepartmentName" runat="server" Text='<%#Bind("DepartmentName")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Путь размещения" SortExpression="WebPath">
                        <ItemTemplate>
                            <a href='<%#Eval("WebPath")%><%=TaskKernelConfiguration.SuffixPath%><%=TaskKernelConfiguration.SeparatorPath%><%=TaskKernelConfiguration.DefaultPage%>'>
                                <%#Eval("WebPath")%><%=TaskKernelConfiguration.SuffixPath%><%=TaskKernelConfiguration.SeparatorPath%><%=TaskKernelConfiguration.DefaultPage%></a>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="WebPath" runat="server" Text='<%#Bind("WebPath")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="E-mail">
                        <ItemTemplate>
                            <asp:Label ID="DepartmentMail" runat="server" Text='<%#Bind("MailBox")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="DepartmentMail" runat="server" Text='<%#Bind("MailBox")%>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Рекламации">
                        <ItemTemplate>
                            <asp:CheckBox Enabled="false" ID="Claim" runat="server" Checked='<%#Bind("IsClaim")%>'></asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="Claim" runat="server" Checked='<%#Bind("IsClaim")%>'></asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Огр.нотифик.">
                        <ItemTemplate>
                            <asp:CheckBox Enabled="false" ID="IsClaimNotify" runat="server" Checked='<%#Bind("IsClaimNotify")%>'></asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="IsClaimNotify" runat="server" Checked='<%#Bind("IsClaimNotify")%>'></asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                     <asp:TemplateField HeaderText="Обяз.оценка">
                        <ItemTemplate>
                            <asp:CheckBox Enabled="false" ID="RatingRequired" runat="server" Checked='<%#Bind("RatingRequired")%>'></asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="RatingRequired" runat="server" Checked='<%#Bind("RatingRequired")%>'></asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                                            Text="Изменить"></asp:LinkButton>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                                            Text="ОК"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                                  Text="Отмена"></asp:LinkButton>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="Button2" runat="server" CausesValidation="False" CommandName="Delete"
                                            Text="Удалить" OnClientClick="return confirm('Удалить ?');" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle HorizontalAlign="Right" />
                <RowStyle HorizontalAlign="Right" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>